package edu.wong.pro.action;



import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

import edu.wong.pro.iservice.IPlanActivity;

public class PlanActivityAction extends ActionSupport{
	private IPlanActivity iPlanActivity;

	public IPlanActivity getiPlanActivity() {
		return iPlanActivity;
	}

	public void setiPlanActivity(IPlanActivity iPlanActivity) {
		this.iPlanActivity = iPlanActivity;
	}
	
	//获取当月的计划活动供主页显示
	public void getCurrentMonthPlanAct() throws IOException{
		HttpServletResponse response = (HttpServletResponse) ServletActionContext.getResponse();
		response.setCharacterEncoding("utf-8");
		PrintWriter writer = response.getWriter();
		writer.print(iPlanActivity.getCurrentPlanAct());
		writer.flush();
		writer.close();
		
	}
	//通过ID查找计划活动
	public void getPlanActByID() throws IOException{
		HttpServletRequest request = (HttpServletRequest) ServletActionContext.getRequest();
		String planId = request.getParameter("planId");
		HttpServletResponse response = (HttpServletResponse) ServletActionContext.getResponse();
		response.setCharacterEncoding("utf-8");
		PrintWriter writer = response.getWriter();
		writer.print(iPlanActivity.getPlanActById(planId));
		writer.flush();
		writer.close();
	}
	
}
